<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>路由入门</title>
	</head>
	<body>
		
		<div id="app">
		    <h1>实现路由案例</h1>
			<!--2. 定义路由标签 -->
			<router-link to="/home">主页</router-link>
			<router-link to="/welcome">按下</router-link>
			<!-- 3.指定路由填充位(占位符) -->
			<router-view></router-view>
		</div>
		<template id="homeTem">
			<div>
				<h1>这里是系统首页</h1>
			</div>
		</template>
		
		<template id="welcomeTem">
			<div>
				<h1>是系统首页</h1>
			</div>
		</template>

		<script src="../js/vue.js"></script>
		<script src="../js/vue-router.js"></script>
		<script>
		let HomeCom={
			template:"#homeTem"
		}
		let Welcome={
			template:"#welcomeTem"
		}
		let router=new VueRouter({
			routes:[
				{path:"/home",component:HomeCom},
				{path:"/welcome",component:Welcome}
			]
		})
		const app=new Vue({
			el:"#app",
			router
		})
		
		</script>
	</body>
</html>
